<import file="block/common.html" name="url"/>
<div class="layui-fluid">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-body ">
                <blockquote class="layui-elem-quote">
                    <b>提示：</b>每个按钮下的设置都需要单独点击保存！！
                </blockquote>
            </div>
        </div>
    </div>

    <button type="button" class="layui-btn layui-btn-primary" onclick="loadMain('<{caUrl('system','index')}>&name=siteinfo&menuname=网站设置')">网站设置</button>
    <button type="button" class="layui-btn layui-btn-primary" onclick="loadMain('<{caUrl('system','index')}>&name=cache&menuname=缓存设置')">缓存设置</button>
    <button type="button" class="layui-btn" onclick="loadMain('<{caUrl('system','index')}>&name=upload&menuname=上传设置')">上传设置</button>

</div>
<div class="layui-fluid">
 <div class="layui-form">
    <fieldset class="layui-elem-field" style="margin-top: 10px;padding-top: 10px;">
        <legend>图片上传设置</legend>
	<div class="layui-form-item">
        <label class="layui-form-label">最大上传</label>
        <div class="layui-input-inline" style="width: 80px;">
            <input type="text" name="imguploadsize" lay-verify="number" value="<{$config['imguploadsize']}>" class="layui-input">
        </div>
        <div class="layui-input-inline layui-input-company" style="width: 30px;line-height: 35px;">KB</div>
        <div class="layui-form-mid layui-word-aux">1 M = 1024 KB</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上传类型</label>
        <div class="layui-input-inline" style="width:380px;">
            <input type="text" name="imguploadext" value="<{$config['imguploadext']}>" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">如：.jpg|.png|.jpeg|.gif</div>
    </div>
    <hr>
    <div class="layui-form-item">
        <label class="layui-form-label required">开启缩略图</label>
        <div class="layui-input-inline" style="height: 38px;line-height: 38px;">
            <input type="checkbox" name="thumbON" lay-skin="switch" lay-filter="thumbON" lay-text="ON|OFF" value="1" <?php echo $config['thumbON']==1 ?'checked':'';?>>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">缩略最宽</label>
        <div class="layui-input-inline" style="width: 80px;">
            <input type="text" name="maxWidth" value="<{$config['maxWidth']}>" class="layui-input">
        </div>
        <div class="layui-input-inline layui-input-company" style="width: 30px;line-height: 35px;">px</div>
        <div class="layui-form-mid layui-word-aux">如：1100</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">缩略最高</label>
        <div class="layui-input-inline" style="width: 80px;">
            <input type="text" name="maxHeight" value="<{$config['maxHeight']}>" class="layui-input">
        </div>
        <div class="layui-input-inline layui-input-company" style="width: 30px;line-height: 35px;">px</div>
        <div class="layui-form-mid layui-word-aux">如：900</div>
    </div>
    <hr>
    <div class="layui-form-item">
        <label class="layui-form-label required">开启水印</label>
        <div class="layui-input-inline"  style="height: 38px;line-height: 38px;">
            <input type="checkbox" name="waterON" lay-skin="switch" lay-filter="waterON" lay-text="ON|OFF" value="1" <?php echo $config['waterON']==1 ?'checked':'';?>>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
           <img id="waterImgSrc" src="/res/img/waterimg/logo.png">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图片位置</label>
        <div class="layui-input-block">
            <span style="height: 38px;line-height: 38px;">/res/img/waterimg/logo.png</span>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">水印位置</label>
        <div class="layui-input-inline">
            <select name="waterPos" lay-verify="">
                <option value="0" <?php if($config['waterPos'] == 0){echo 'selected';}?>>随机位置</option>
                <option value="1" <?php if($config['waterPos'] == 1){echo 'selected';}?>>左上</option>
                <option value="2" <?php if($config['waterPos'] == 2){echo 'selected';}?>>上中</option>
                <option value="3" <?php if($config['waterPos'] == 3){echo 'selected';}?>>右上</option>
                <option value="4" <?php if($config['waterPos'] == 4){echo 'selected';}?>>左中</option>
                <option value="5" <?php if($config['waterPos'] == 4){echo 'selected';}?>>正中</option>
                <option value="6" <?php if($config['waterPos'] == 6){echo 'selected';}?>>右中</option>
                <option value="7" <?php if($config['waterPos'] == 7){echo 'selected';}?>>左下</option>
                <option value="8" <?php if($config['waterPos'] == 8){echo 'selected';}?>>下中</option>
                <option value="9" <?php if($config['waterPos'] == 9){echo 'selected';}?>>右下</option>
              </select>
        </div>
    </div>
</fieldset>
<fieldset class="layui-elem-field" style="margin-top:20px;padding-top: 10px;">
    <legend>附件上传设置</legend>
    <div class="layui-form-item">
        <label class="layui-form-label">最大上传</label>
        <div class="layui-input-inline" style="width: 80px;">
            <input type="text" name="attuploadsize" lay-verify="number" value="<{$config['attuploadsize']}>" class="layui-input">
        </div>
        <div class="layui-input-inline layui-input-company" style="width: 30px;line-height: 35px;">KB</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上传类型</label>
        <div class="layui-input-inline" style="width:380px;">
            <input type="text" name="attuploadext" value="<{$config['attuploadext']}>" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">如：.doc|.docx|.zip|.7z|.zip|.xls|.xlsx</div>
    </div>
</fieldset>
<div class="layui-form-item">
    <div class="layui-input-block">
    <?php echo sysrolTF("siteconfig_edit")?'<button class="layui-btn" lay-submit lay-filter="setting">'.lang('save').'</button>':''; ?> 
    </div>
</div>
</div>
</div>

<script>
    layui.use(['form'], function () {
        var form = layui.form
            , layer = layui.layer,
			$ = layui.jquery;
        form.render();

        //监听提交
		form.on('submit(setting)', function (data) {
			$.post('<{caUrl("system","edit")}>&name=upload',data.field,function(res){
                if(res.status == 1){
                    layer.msg(res.info, {icon: 1, time: 1000}, function(){
                        loadMain('<{caUrl("system","index")}>&name=upload');
                    });
                }else{
                    layer.msg(res.info, {icon: 1, anim: 6, time: 5000});
                }
            });
		});
    });
</script>
